<template>
    <h1>{{ title }}</h1>
    <button @click="handleClick">显示/隐藏</button>
    <com v-if="flag"></com>
</template>

<script setup lang="ts">
import com from "./com.vue";
import { useRoute } from "vue-router";
import { ref } from "vue";

const route = useRoute();

const title = ref("lifeCycle");

if (route.meta && route.meta.title) {
    title.value = route.meta.title as string;
}

const flag = ref(true);

const handleClick = () => {
    flag.value = !flag.value;
};
</script>

<style scoped></style>
